﻿Public Class Timesync
    Dim h1
    Dim m1
    Dim s1
    Dim d1
    Dim mon1
    Dim j1

    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        Try
            'Systemzeit festlegen 
            Dim currentTime As DateTime
            currentTime = CDate(h1 & ":" & m1 & ":" & s1)
            TimeOfDay = currentTime
            'Systemdatum festlegen 
            Dim currentdate As Date
            currentdate = CDate(d1 & "." & mon1 & "." & "20" & j1)
            Today = currentdate
        Catch
            MsgBox("Satellit Stream Abgebrochen!")
        End Try
    End Sub

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
        Me.Hide()
    End Sub

   
    
    Public Sub tick(ByVal h, ByVal m, ByVal s, ByVal day, ByVal mon, ByVal j)
        OK.Enabled = True
        If CheckBox1.Checked = True Then
            h = h + 1


        End If
        h1 = h
        m1 = m
        s1 = s
        d1 = day
        mon1 = mon
        j1 = j
        TextBox2.Text = (day & "." & mon & "." & "20" & j)
        TextBox1.Text = (h & ":" & m & ":" & s)
        TextBox4.Text = (My.Computer.Clock.LocalTime.Day & "." & My.Computer.Clock.LocalTime.Month & "." & My.Computer.Clock.LocalTime.Year)
        TextBox3.Text = (My.Computer.Clock.LocalTime.Hour & ":" & My.Computer.Clock.LocalTime.Minute & ":" & My.Computer.Clock.LocalTime.Second)


    End Sub

    Private Sub Timesync_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MsgBox("Wenn ein Satellit eine falsche Zeit sendet, kann die Zeit oder das Datum abweichen.", MsgBoxStyle.Information)
        Me.TopMost = True
    End Sub
End Class
